<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->default('')->comment('文章标题');
            $table->integer('pid')->nullable()->comment('所属分类');
            $table->string('source')->default('')->comment('文章来源');
            $table->string('editor')->default('')->comment('文章作者');
            $table->string('thump')->nullable()->comment('缩略图');
            $table->mediumText('description')->nullable()->comment('文章简介');
            $table->text('content')->comment('文章内容');
            $table->tinyInteger('is_index')->nullable()->comment('是否推荐到首页');
            $table->integer('tips')->unsigned()->default(0)->comment('文章查看次数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('articles');
    }
}
